import * as NSBase from '../../Common/NetServiceBase';
import {
    T_FAQ,
    TYConfig,
    Wx_Page,
    Wx_PageData,
    WXDataClassRuntimeDecorator
    } from '../EntityBase';

//NS.QueryAllFAQ
@WXDataClassRuntimeDecorator()
export class FAQBasePageData extends Wx_PageData {
    public FAQS: Array<T_FAQ> = new Array<T_FAQ>();
}
export class FAQBasePage extends Wx_Page {

    public Data = new FAQBasePageData();

    /**
     * 初始化页面信息
     * 
     * @memberof CommonProblemPage
     */
    public async InitData(options: any) {
        try {
            wx.showLoading({ title: "加载中···" });
            let r = await NSBase.QueryAllFAQ(TYConfig.QueryAllFAQ);
            this.Data.FAQS = r;
            await this.Data.ApplyChange(this);
        } catch (error) {
            this.ShowError(error);
        } finally {
            wx.hideLoading();
        }
    }

    public RefreshHandler(e: any): void {
        this.InitData(null);
    }
}